<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Use snapshot mode for the query</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="mongocursor.slaveokay.html">« MongoCursor::slaveOkay</a></li>
      <li style="float: right;"><a href="mongocursor.sort.html">MongoCursor::sort »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="class.mongocursor.html">MongoCursor</a></li>
    <li>Use snapshot mode for the query</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="mongocursor.snapshot" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">MongoCursor::snapshot</h1>
  <p class="verinfo">(PECL mongo &gt;=0.9.4)</p><p class="refpurpose"><span class="refname">MongoCursor::snapshot</span> &mdash; <span class="dc-title">Use snapshot mode for the query</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-mongocursor.snapshot-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>MongoCursor::snapshot</strong></span>(): <span class="type"><a href="class.mongocursor.html" class="type MongoCursor">MongoCursor</a></span></div>

  <p class="para rdfs-comment">
   Use snapshot mode for the query. Snapshot mode ensures that a document will
   not be returned more than once because an intervening write operation results
   in a move of the document. Documents inserted or deleted during the lifetime
   of the cursor may or may not be returned, irrespective of snapshot mode.
  </p>
  <p class="para">
   Queries with short responses (less than 1MB) are always effectively
   snapshotted.
  </p>
  <p class="para">
   Snapshot mode may not be used with sorting, explicit hints, or queries on
   sharded collections.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-mongocursor.snapshot-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">This function has no parameters.</p>
 </div>
 

 <div class="refsect1 returnvalues" id="refsect1-mongocursor.snapshot-returnvalues">
  <h3 class="title">Return Values</h3>  
  <p class="para">
   Returns this cursor.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-mongocursor.snapshot-errors">
  <h3 class="title">Errors/Exceptions</h3>
  <p class="para">
   Throws <a href="class.mongocursorexception.html" class="classname">MongoCursorException</a> if this cursor has started iterating.
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-mongocursor.snapshot-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   MongoDB core docs on <a href="https://docs.mongodb.com/manual/reference/operator/meta/snapshot/" class="link external">&raquo;&nbsp;$snapshot operator</a>.
  </p>
 </div>

</div></div></div></body></html>